﻿Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Globalization
Imports System.Windows.Data

Class TablesStateConverter
    Implements IValueConverter
    Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert

        Try
            Dim state As Boolean = CBool(value)
            If state = True Then
                Return "/Images/BusyTable.ico"
            Else
                Return "/Images/FreeTable.ico"
            End If
        Catch
            Dim state As String = DirectCast(value, String)
            If state = "True" Then
                Return "/Images/BusyTable.ico"
            Else
                Return "/Images/FreeTable.ico"
            End If
        End Try
    End Function
    Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
        Throw New NotSupportedException("This converter is for grouping only.")
    End Function
End Class
